var WORK_SPINNER_ICON_SIZE = 16;
+const DELAYED_RESET_TIMEOUT = 200;
+
var AuthenticationDialog = GObject.registerClass({
Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } }
}, class AuthenticationDialog extends ModalDialog.ModalDialog {
}
performAuthentication() {
- this._destroySession();
+ this._destroySession(DELAYED_RESET_TIMEOUT);
+
this._session = new PolkitAgent.Session({ identity: this._identityToAuth,
cookie: this._cookie });
this._sessionCompletedId = this._session.connect('completed', this._onSessionCompleted.bind(this));
}
_onSessionRequest(session, request, echoOn) {
+ if (this._sessionRequestTimeoutId) {
+ GLib.source_remove(this._sessionRequestTimeoutId);
+ this._sessionRequestTimeoutId = 0;
+ }
+
// Cheap localization trick
if (request == 'Password:' || request == 'Password: ')
this._passwordLabel.set_text(_("Password:"));
this._ensureOpen();
}
- _destroySession() {
+ _destroySession(delay = 0) {
if (this._session) {
if (!this._completed)
this._session.cancel();
this._session = null;
}
- this._passwordBox.hide();
- this._cancelButton.grab_key_focus();
- this._okButton.reactive = false;
+ if (this._sessionRequestTimeoutId) {
+ GLib.source_remove(this._sessionRequestTimeoutId);
+ this._sessionRequestTimeoutId = 0;
+ }
+
+ let resetDialog = () => {
+ this._passwordBox.hide();
+ this._cancelButton.grab_key_focus();
+ this._okButton.reactive = false;
+ };
+
+ if (delay) {
+ this._sessionRequestTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, delay, resetDialog);
+ GLib.Source.set_name_by_id(this._sessionRequestTimeoutId, '[gnome-shell] this._sessionRequestTimeoutId');
+ } else {
+ resetDialog();
+ }
}
_onUserChanged() {
_onDialogClosed() {
if (this._sessionUpdatedId)
Main.sessionMode.disconnect(this._sessionUpdatedId);
- this._sessionUpdatedId = 0;
+
+ if (this._sessionRequestTimeoutId)
+ GLib.source_remove(this._sessionRequestTimeoutId);
+ this._sessionRequestTimeoutId = 0;
if (this._user) {
this._user.disconnect(this._userLoadedId);